<template>
  <div>
    <a-card title="查询条件" class="search">
      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
        <a-form-model ref="ruleForm" :model="queryParam" :rules="rules" layout="inline" @keyup.enter.native="onSearch">
          <a-row :gutter="24">
            <a-col :md="6" :sm="6">
              <a-form-model-item label="编号" prop="number">
                <a-input v-model="queryParam.number" placeholder="请填写编号"> </a-input>
              </a-form-model-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-model-item label="审核状态" prop="state">
                <j-dict-select-tag v-model="queryParam.state" placeholder="请选择审核状态" dictCode="generate_type" />
              </a-form-model-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-model-item label="提交时间" prop="arrayTime">
                <a-range-picker
                  v-model="queryParam.arrayTime"
                  format="yyyy-MM-DD"
                  value-format="yyyy-MM-DD"
                  @change="handleDatechange"
                />
              </a-form-model-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <span style="float: right" class="table-page-search-submitButtons">
                <a-button type="primary" @click="onSearch" icon="search">查询</a-button>
                <a-button @click="searchReset" icon="reload" class="clear_btn">清除条件</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form-model>
      </div>
    </a-card>
    <a-card style="margin-top: 20px">
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <template v-slot:typeName="text">
          <j-ellipsis :value="text" :length="10"></j-ellipsis>
        </template>
        <template v-slot:proName="text">
          <j-ellipsis :value="text" :length="10"></j-ellipsis>
        </template>
        <template v-slot:ydmc="text">
          <j-ellipsis :value="text" :length="10"></j-ellipsis>
        </template>
        <template v-slot:ydnr="text">
          <j-ellipsis :value="text" :length="10"></j-ellipsis>
        </template>
        <template v-slot:bsjdwName="text">
          <j-ellipsis :value="text" :length="10"></j-ellipsis>
        </template>
        <template v-slot:zxrText="text">
          <j-ellipsis :value="text" :length="10"></j-ellipsis>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record, '编辑疑点')">编辑</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </a-card>
    <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CheckAndEditModel from './CheckAndEditModel'
import { getAction, httpAction } from '@/api/manage'
import columns from './indexColumns'

export default {
  name: 'sjyd',
  components: {
    CheckAndEditModel,
  },
  mixins: [JeecgListMixin],
  data() {
    return {
      /* table选中keys*/
      selectedRowKeys: [],
      /* table选中records*/
      selectionRows: [],
      //表头
      queryParam: {
        number: '',
        state: undefined,
        startTime: '',
        endTime: '',
        arrayTime: [],
      },
      columns: columns(this),
      url: {
        list: '/sjmx/queryMyDoubtfulPoint',
        delete: '/sjxmzygl/sjWorkZtfaEveYidian/remove',
      },
    }
  },
  methods: {
    onSearch() {
      this.$refs.ruleForm.validate((value) => {
        if (value) {
          this.loadData(1)
        }
      })
    },
    searchReset() {
      this.queryParam = this.$options.data().queryParam
      this.loadData(1)
    },
    handleDatechange(dates) {
      this.queryParam.startTime = dates[0]
      this.queryParam.endTime = dates[1]
    },
  },
}
</script>

<style lang="less" scoped>
@import '~@assets/less/tableTheme.less';
</style>